package com.biyu.monitormanage.enums;

import java.util.Objects;

/**
 * 机器位置
 * @author 15491
 * @since 2022/3/23
 */

public enum PositionEnums {

    /**
     * 东侧
     */
    EAST_POS(3, "东侧"),

    /**
     * 西侧
     */
    WEST_POS(2, "西侧"),

    /**
     * 北侧
     */
    NORTH_POS(0,"北侧"),

    /**
     * 南侧
     */
    SOUTH_POS(1, "南侧");

    private final Integer code;

    private final String description;

    PositionEnums(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static String getPosDes(Integer code) {
        if (Objects.nonNull(code)) {
            for (PositionEnums posValues : PositionEnums.values()) {
                if (Objects.equals(code, posValues.getCode())) {
                    return posValues.getDescription();
                }
            }
        }
        return null;
    }
}
